Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More nullability annotation work #70

Merged
merged 5 commits into from
May 16, 2017
Merged

More nullability annotation work #70

merged 5 commits into from
May 16, 2017

Conversation

ZacSweers
Copy link
Collaborator

@ZacSweers ZacSweers commented May 14, 2017

This is a followup to #69, and improves it in two main ways:

  • This adds it to subpackages as well, which I missed in the first pass.
  • Switches to a custom PackageNonNull annotation instead, which expands the checks to also include return types, fields, local vars, etc. It's pretty broad right now but we could reduce scope if need be. This is pulled into a separate artifact for re-use, but still only applied as compileOnly. @ParametersAreNonnullByDefault actually only covers method parameters it seems.

This is a followup to #69, and improves it in two main ways:
- This adds it to subpackages as well, which I missed in the first pass.
- Switches to a custom `PackageNonNull` annotation instead, which expands the checks to also include return types, fields, local vars, etc. It's pretty broad right now but we could reduce scope if need be. This is pulled into a separate artifact for re-use, but still only applied as compileOnly.
@@ -0,0 +1,3 @@
POM_NAME=AutoDispose (Provided)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we shipping this to maven? this is compileOnly

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still needs to be available in sources jar for static analysis right?

@msridhar
Copy link
Contributor

LGTM. But unless you have public fields, the main change here is that the annotation means return types are @NonNull by default, right?

@ZacSweers
Copy link
Collaborator Author

the annotation applies to parameters, method return types, and fields in general, even private ones (though those only really matter for internal details)

ElementType.METHOD,
ElementType.PARAMETER
})
@Retention(RetentionPolicy.RUNTIME)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SOURCE retention please. Since this is not really shipped out to consumers

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I coped this from @ParametersAreNonnullByDefault, let me see if I can find the justification

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ZacSweers added 2 commits May 16, 2017 15:06
Not necessary, we'll make this a separate project later
@ZacSweers ZacSweers merged commit ce0d555 into master May 16, 2017
@ZacSweers ZacSweers deleted the z/moreNullability branch May 16, 2017 22:37
@ZacSweers ZacSweers modified the milestone: 0.3.0 Sep 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants